<template>
	<view class="page pages">
		<uni-nav-bar left-icon="left" :right-text="$t('order.afterSales.selectService.Changes')" :title="$t('order.afterSales.selectService.Type')" backgroundColor='#F4F3F8' :border="false" @clickLeft="back" @clickRight="q"/>
		<view class="good">
			<view class="flex">
				<image :src="goodInfo.good_mainimg"></image>
				<view class="good_info">
					<view class="good_info_title">{{goodInfo.good_name}}</view>
					<view style="font-size: 28rpx;color: #ccc;">{{goodInfo.sku_name}} {{$t('order.afterSales.selectService.Num')}} {{goodInfo.nums}}</view>
					<view style="font-weight: bold;">￥{{goodInfo.good_price}}</view>
				</view>
			</view>
			<view class="good_price">{{$t('order.afterSales.selectService.Total')}}￥{{goodInfo.money}}</view>
		</view>
		<view class="type">
			<view class="flex_be" @click="toReturn(1)">
				<view>
					<uni-icons type="gift-filled" size="22" style="margin-right: 10rpx;"></uni-icons>{{$t('order.afterSales.selectService.Only')}}
				</view>
				<uni-icons type="forward"></uni-icons>
			</view>
			<view class="flex_be" @click="toReturn(2)">
				<view>
					<uni-icons type="gift-filled" size="22" style="margin-right: 10rpx;"></uni-icons>{{$t('order.afterSales.selectService.Return')}}
				</view>
				<uni-icons type="forward"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	import { serviceGetorder } from '@/api/api.js'
	export default {
		data() {
			return {
				goodInfo: {},
				salesData: {}
			};
		},
		onLoad(option) {
			this.salesData.ordid = option.ordid
			this.salesData.og_id = option.og_id
			serviceGetorder({
				token: uni.getStorageSync('token'),
				ordid: option.ordid,
				og_id: option.og_id
			}).then(res=>{
				this.goodInfo = res.data.data
			})
		},
		methods: {
			back(){
				uni.navigateBack()
			},
			toReturn(num){
				this.salesData.type = num
				uni.navigateTo({
					url: `/pages/shop/order/afterSales/requestReturn?salesData=${JSON.stringify(this.salesData)}`
				})
			},
			q(){
				uni.navigateTo({
					url: `/pages/shop/login/policy?type=3`
				})
			}
		},
		onShow() {
			uni.setNavigationBarTitle({
				title: this.$t('list.Change')
			})
		}
	}
</script>

<style lang="scss">
	.flex{
		display: flex;
		align-items: center;
	}
	.flex_be{
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.page{
		background-color: #F4F3F8;
		min-height: 100vh;
		padding: 1rpx;
		box-sizing: border-box;
	}
	.good{
		background-color: #fff;
		padding: 30rpx 40rpx 50rpx;
		margin:10rpx 30rpx 30rpx;
		image{
			width: 180rpx;
			height: 180rpx;
			border: 2rpx solid #ccc;
			flex-shrink: 0;
		}
		.good_info{
			height: 180rpx;
			margin-left: 20rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			.good_info_title{
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}
		}
		.good_price{
			margin-top: 20rpx;
			padding-top: 20rpx;
			border-top: #ccc 1rpx solid;
			text-align: right;
			color: red;
			font-weight: bold;
		}
	}
	.type{
		background-color: #fff;
		margin:10rpx 30rpx 30rpx;
		padding: 0 40rpx;
		&>view{
			height: 120rpx;
			border-bottom: 1rpx solid #ddd;
			font-size: 34rpx;
		}
		&>view:last-child{
			border-bottom: none;
		}
	}
</style>
